package com.example.lanou.mynews.view;

import android.view.LayoutInflater;
import android.view.View;

import com.example.lanou.mynews.R;
import com.example.lanou.mynews.application.MyApplication;

/**
 * Created by dllo on 16/1/23.
 */
public class ChoseItem {
    private int type;
    private View view;

    public ChoseItem(int type) {
        this.type = type;
    }

    public ChoseItem setType(int type) {
        this.type = type;
        return this;
    }

    /**
     * type 是根据数据具体内容判断的，单写一个方法，判断好type了进行调用这个item方法
     * @return
     */
    public View getItemView() {
        if (type == 1)
            view = LayoutInflater.from(MyApplication.getContext()).inflate(R.layout.item_news_normal, null);
        if (type == 2)
            view = LayoutInflater.from(MyApplication.getContext()).inflate(R.layout.item_news_onebig, null);
        if (type == 3)
            view = LayoutInflater.from(MyApplication.getContext()).inflate(R.layout.item_news_threep, null);
        if (type == 4)
            view = LayoutInflater.from(MyApplication.getContext()).inflate(R.layout.item_type4, null);
        if (type == 5)
            view = LayoutInflater.from(MyApplication.getContext()).inflate(R.layout.item_type5, null);
        if (type == 6)
            view = LayoutInflater.from(MyApplication.getContext()).inflate(R.layout.item_type6, null);
        if (type == 7)
            view = LayoutInflater.from(MyApplication.getContext()).inflate(R.layout.item_type7, null);
        if (type == 8)
            view = LayoutInflater.from(MyApplication.getContext()).inflate(R.layout.item_type8, null);
        if (type == 9)
            view = LayoutInflater.from(MyApplication.getContext()).inflate(R.layout.headview2, null);
        if (type == 10)
            view = LayoutInflater.from(MyApplication.getContext()).inflate(R.layout.headview1, null);
        return view;
    }
}
